/* '点数' 充值/使用记录 */
import request from '@/utils/request';
import {object2Url} from "@/utils/trans";

// 查询充值/使用记录 （未使用）
export async function pointRecharge22 (data) {
  const res = await request.post('/business/MerchantManagement/rechargeRecordPageId', data)
  if (res.data.code === 2000) {
    return res.data;
  }
  return Promise.reject(new Error(res.data.msg));
}

// 充值/使用记录 分页查询
export async function pointRechargePage (data) {
  const res = await request.post('/business/MerchantManagement/pageRechargeRecordPageId', data)
  if (res.data.code === 2000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.msg));
}

// 查询充值/使用记录
// types 1：充值记录 2：使用记录
export async function pointRecharge(id,types) {
  const ts = new Date().getTime();
  const ua = navigator.userAgent;
  const us = {
    ts,
    ua,
    id: id,
    types: types
  };
  // ${object2Url(us)} get 链接传值
  let url = `/business/MerchantManagement/rechargeRecordPageId${object2Url(us)}`
  const res = await request.get(url, us);
  if (res.data.code === 2000) {
    return res.data;
  }
  return Promise.reject(new Error(res.data.message));
}

